package com.bestcem.xm.user.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 单点登录状态枚举
 *
 * @author panyun <yun.pan@idiaoyan.com>
 * @version v1.0
 * @date 2022/3/29 15:27
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum UserSsoStatusEnum {

    /**
     * 单点登录状态枚举
     */
    DISABLED(1, "禁用"),
    ACTIVATED(0, "激活");

    /**
     * 状态
     */
    private Integer status;
    /**
     * 状态描述
     */
    private String desc;

    /**
     * 通过status获取
     *
     * @param status
     * @return
     */
    public static UserSsoStatusEnum getByStatus(Integer status) {
        if (status != null) {
            for (UserSsoStatusEnum value : values()) {
                if (value.getStatus().equals(status)) {
                    return value;
                }
            }
        }
        return null;
    }
}
